package main;
/**
 * basic class for tech
 * @author Bart Machielse and Justin Yu
 *
 */
public class Tech {

	private int cost;//amount of res that needs to be spent
	boolean complete=false;
	protected int techtype=0; //1 = war 2=econ
	protected int techlevel=0; //how hard to research
	protected Player Owner;
	protected String Name;
	protected String Explanation;
	
	/**
	 * bas constructor
	 * @param ncost cost of the tech in resources
	 * @param o Player owner
	 */
	public Tech(int ncost, Player o){
		cost=ncost;
		Owner=o;
	}
	/**
	 * INCREMENTS AND RETURNS IF COMPLETE!!!
	 * @param cost
	 * @return true/false tech complete
	 */
	public boolean IncrementTurn(double res){
		cost+=-(int)res;
		System.out.println(cost);
		if(cost<=0)
		{
			this.complete();
			return true;
		}
		return false;
	}
	/**
	 * complete the tech. Always overwritten, not specific
	 */
	public void complete(){
		complete=true;
		//do stuff upon completion here.
	}
	/**
	 * @return the name
	 */
	public String getName() {
		return Name;
	}
	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		Name = name;
	}
	public int getCost() {
		return cost;
	}
	public void setCost(int cost) {
		this.cost = cost;
	}
	/**
	 * @return the techtype
	 */
	public int getTechtype() {
		return techtype;
	}
	/**
	 * @param techtype the techtype to set
	 */
	public void setTechtype(int techtype) {
		this.techtype = techtype;
	}
	/**
	 * @return the techlevel
	 */
	public int getTechlevel() {
		return techlevel;
	}
	/**
	 * is complete
	 * @return booelan is copmlete?
	 */
	public boolean isComplete(){
		return complete;
	}
	/**
	 * @return the explanation
	 */
	public String getExplanation() {
		return Explanation;
	}
	/**
	 * @param explanation the explanation to set
	 */
	public void setExplanation(String explanation) {
		Explanation = explanation;
	}
	
}
